package cz.patamat.support;

import java.util.List;


/**
 * Promotion web answer sheet to get to know clients preferences and current habits when they are
 * moving from dormitory to home or back.
 *
 */
final public class PromowebAnswerSheet
extends AnswerSheet {
	
	public PromowebAnswerSheet() {
		Question question1 = new Question("q1", "Jakým způsobem se stěhuješ přič z koleje?");
		question1.addAnswer(new Answer("a0", "[vyber jednu z možností]"));
		question1.addAnswer(new Answer("a1", "vlastním autem"));
		question1.addAnswer(new Answer("a2", "věci mi odveze někdo z rodiny"));
		question1.addAnswer(new Answer("a3", "spolu s kamarádama"));
		question1.addAnswer(new Answer("a4", "svépomocně vlakem nebo autobusem"));
		question1.addAnswer(new Answer("a5", "věci nechávám na koleji (např. v kufrárně)"));
		question1.addAnswer(new Answer("a6", "jinak"));
		
		Question question2 = new Question("q2", "Myslíš, že by jsi využil služby, která ti odstěhuje věci z koleje až domů?");
		question2.addAnswer(new Answer("a0", "[vyber jednu z možností]"));
		question2.addAnswer(new Answer("a1", "ano, takovou službu bych přivítal"));
		question2.addAnswer(new Answer("a2", "měl bych problém s důvěrou"));
		question2.addAnswer(new Answer("a3", "ne, takovou službu nepotřebuji"));
		
		Question question3 = new Question("q3", "Co je pro tebe nejdůležitejší při stěhování z koleje domů?");
		question3.addAnswer(new Answer("a1", "cena"));
		question3.addAnswer(new Answer("a2", "mít to z krku co nejdřív"));
		question3.addAnswer(new Answer("a3", "nezatěžovat rodinu a známých"));
		question3.addAnswer(new Answer("a4", "stěhovat se, kdy se to hodí mně"));
		question3.addAnswer(new Answer("a5", "jiné"));
		
		Question question4 = new Question("q4", "Ve které zemi bydlíš?");
		question4.addAnswer(new Answer("a0", "[vyber jednu z možností]"));
		question4.addAnswer(new Answer("a1", "Česká rebublika"));
		question4.addAnswer(new Answer("a2", "Slovensko"));
		
		questions.add(question1);
		questions.add(question2);
		questions.add(question3);
		questions.add(question4);
	}
	
	public List<Question> getQuestions() {
		return questions;
	}

	public void respondQuestion1(String question1AnswerId) {
		markAnswerToQuestion("q1", question1AnswerId);
	}
	
	public void respondQuestion2(String question2AnswerId) {
		markAnswerToQuestion("q2", question2AnswerId);
	}
	
	public void respondQuestion3(String... question3AnswerIds) {
		for (String question3AnswerId: question3AnswerIds) {
			markAnswerToQuestion("q3", question3AnswerId);
		}
	}
	
	public void respondQuestion4(String question4AnswerId) {
		markAnswerToQuestion("q4", question4AnswerId);
	}

	/**
	 * Make string representation of answer sheet which contains all questions
	 * and marked answers of each question.
	 * @return
	 */
	public String responsesToString() {
		StringBuffer buffer = new StringBuffer();
		for (Question question: questions) {
			buffer.append(question.getText());
			for (Answer answer: question.getMarkedAnswers()) {
				buffer.append("\n");
				buffer.append("\t" + answer.getText());
			}
			buffer.append("\n\n");
		}
		return buffer.toString();
	}	

}
